package com.shebao.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.shebao.dao.SBUserDao;
import com.shebao.entity.SBUserEntity;
import com.shebao.utils.CompanyStuffPDFUtil;
import com.shebao.utils.FileUtil;

@Service
public class CompanyService {
	@Autowired
	private SBUserDao sBUserDao;
	@Autowired
	private CompanyStuffPDFUtil companyStuffPDFUtil;
	@Autowired
	private FileUtil fileUtil;
	public List<SBUserEntity> list(){
		List<SBUserEntity> list=sBUserDao.list();
		return list;
	}
	
	public byte[] printCompany(){
		byte[] bos=null;
		List<SBUserEntity> list=list();
		try {
			String outPath=companyStuffPDFUtil.createPDF(list);
			bos=fileUtil.read(outPath);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return bos;
	}
	
}
